﻿<div class="well with-header" ng-controller="GetHelpController">
    <div class="header bg-themeprimary">
        GH
        <div class="btn-group pull-right">
            <!--<span class="btn btn-sm" ng-click="popup('','FormCashOutModal','CashoutModalInstanceCtrl','sm')" ng-if="true"><i class="fa fa-plus-circle"></i> Cashout</span>-->
        </div>
    </div>
    <div class="body">
        <div class="row">
            <div class="col-sm-12">
                <table class="table table-bordered table-striped table-condensed flip-content">
                    <thead class="flip-content bordered-palegreen">
                        <tr>
                            <th width="1%">#</th>
                            <th>CreateDate</th>
                            <th width="10%">Status</th>
                            <th>Value</th>
                            <th>PH User</th>
                            <th>PH Name</th>
                            <th>Remaining</th>
                            <th>Type</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody ng-repeat="data in List" ng-show="List.length != 0" style="border:1px solid #ccc !important;">
                        <tr ng-style="data.Status === 0 && {'background-color':'white'} ||data.Status == 1 && {'background-color':'#9DFFB0'} ||data.Status == 2 && {'background-color':'#FFB74D'} || data.Status == 3 && {'background-color':'#9DFFB0'}" >
                            <td class=" numeric">
                            {{$index+1}}</td>
                            <td class="numeric">{{data.CreateDate}}</td>
                            <td>{{data.StatusName}}</td>
                            <td>{{data.Amount | number}}</td>
                            <td></td>
                            <td></td>
                            <td>{{data.Remaining}}</td>
                            <td>{{data.TypeName}}</td>
                            <td></td>
                        </tr>
                        <tr ng-repeat="item in data.TransferOrder" ng-show="item.TransferOrder.length != 0" ng-style="item.Status == 2 && {'background-color':'#c4ffcf'} || item.Status == 1 && {'background-color':'#FFE0B2'}">
                            <td class="numeric"></td>
                            <td>{{item.CreateDate | amUtc | amDateFormat:'DD/MM/YYYY HH:mm:ss A'}}</td>
                            <td>
                                <span ng-if="item.Status == 0 && item.ShowConfirm == false">Proccesing</span>
                                <span ng-if="item.Status == 0 && item.ShowConfirm == true">Confirmed</span>
                                <span ng-if="item.Status == 1">Bad</span>
                                <span ng-if="item.Status == 2">Complete</span>
                            </td>
                            <td>{{item.Amount | number}}</td>
                            <td>{{item.PH_Name}}</td>
                            <td>{{item.PH_Mobile}}</td>
                            <td>{{item.Remaining}}</td>
                            <td></td>
                            <td>
                                <a href="#" class="at-view" ng-click="popup('','FormPHViewModal','PHViewModalInstanceCtrl','lg',{{item.UserPH}},{{item.Id}})">View</a>
                                <a href="#" class="at-confirm" ng-if="item.ShowConfirm == true && item.Status != 2 && item.Status != 5" ng-click="doConfirm(item.Id)" confirm="Are you sure confirm this ?">Confirm</a>
                                <a href="#" class="at-bad" ng-click="popup('','FormBadReportPHModal','ReportPHModalInstanceCtrl','lg',{{item.Id}},'')"> Report</a>
                                <!--<a href="#" class="at-bad" ng-if="item.Remaining=='0' && item.Status != 2" ng-click="popup('','FormBadReportPHModal','ReportPHModalInstanceCtrl','lg',{{item.Id}},'')"> Report</a>-->
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <!--- View GH --->
    <script type="text/ng-template" id="FormPHViewModal">
        <div class="modal-header">
            <strong>PH User Information</strong>          
            <button type="button" class="close" data-dismiss="modal" aria-label="Close" ng-click="cancel()"><span aria-hidden="true">&times;</span></button>
        </div>
        <div class="modal-body">
            <p class="text-danger">{{messeger}}</p>
            <span id="noticePH"></span>
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label style="width:30%;font-weight:bold;text-align:right;">PH User :</label>
                        <label>{{user.UserName}}</label>
                    </div>
                    <div class="form-group">
                        <label style="width:30%;font-weight:bold;text-align:right;">PH Full Name :</label>
                        <label>{{user.HoTen}}</label>
                    </div>
                    <div class="form-group">
                        <label style="width:30%;font-weight:bold;text-align:right;">PH Mobile :</label>
                        <label>{{user.SDTNHARIENG}}</label>
                    </div>
                    <div class="form-group">
                        <label style="width:30%;font-weight:bold;text-align:right;">PH Bank Number :</label>
                        <label>{{user.SoTaiKhoan}}</label>
                    </div>
                    <div class="form-group">
                        <label style="width:30%;font-weight:bold;text-align:right;">PH Bank Name :</label>
                        <label>{{user.BankName}}</label>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label style="width:30%;font-weight:bold;text-align:right;">Upline User :</label>
                        <label>{{parent.UserName}}</label>
                    </div>
                    <div class="form-group">
                        <label style="width:30%;font-weight:bold;text-align:right;">Upline Full Name :</label>
                        <label>{{parent.HOTEN}}</label>
                    </div>
                    <div class="form-group">
                        <label style="width:30%;font-weight:bold;text-align:right;">Upline Mobile :</label>
                        <label>{{parent.SDTNHARIENG}}</label>
                    </div>
                </div>
                <br style="clear:both" />
                <p style="width:100%; font-size:15px; text-indent:2%;background-color:#F5F5F5;line-height:30px; font-weight:bold;"> Notification from PH</p>
                <div class="col-md-6">
                    <img src="{{imagePH}}" class="img-responsive" style="max-width:850px !important;vertical-align:middle;text-align:left;"/>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button class="btn btn-default" ng-click="cancel()" data-dismiss="modal">Close</button>
        </div>
    </script>
    <!---/View GH --->
    <!--- Bad Report PH --->
    <script type="text/ng-template" id="FormBadReportPHModal">
        <div class="modal-header">
            <strong>Report PH</strong>
        </div>
        <div class="modal-body">
            <p class="text-danger">{{messeger}}</p>
            <form name="BadPH" method="post" class="bv-form" novalidate>
                <div class="row">
                    <div>
                        <div class="form-group">
                            <label style="width:30%;font-weight:bold;text-align:right;">PH User :</label>
                            <label>{{trans.PH_Name}}</label>
                        </div>
                        <div class="form-group">
                            <label style="width:30%;font-weight:bold;text-align:right;">PH Mobile :</label>
                            <label>{{trans.PH_Mobile}}</label>
                        </div>
                        <div class="form-group">
                            <label style="width:30%;font-weight:bold;text-align:right; vertical-align:top;">Reason :</label>
                            <textarea ng-model="desc" placeholder="Content" style="background-color:white !important;width:60%!important;"></textarea>
                        </div>
                        <div class="form-group">
                            <label style="width:30%;font-weight:bold;text-align:right; vertical-align:top;line-height:50px;">Type of replacement :</label>
                            <ui-select ng-model="actiontype.selected" style="background-color:white !important;width:30%!important;display:inline-block;">
                                <ui-select-match placeholder="Select type...">
                                    {{$select.selected.Name}}
                                </ui-select-match>
                                <ui-select-choices repeat="item in badtype | filter: $select.search">
                                    <span ng-bind="item.Name"></span>
                                </ui-select-choices>
                            </ui-select>
                            {{trans.actionType = actiontype.selected.Id;""}}
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="modal-footer">
            <span ng-if="processing" class="text-success"><i class="fa fa-circle-o-notch fa-spin"></i></span>
            <button type="button" class="btn btn-success" ng-click="doReport(trans.Id,desc,trans.actionType)" ng-disabled="processing">Submit</button>
            <button class="btn btn-default" ng-click="cancel()" data-dismiss="modal">Close</button>
        </div>
    </script>
    <!---/Bad Report PH --->
    <script type="text/ng-template" id="FormCashOutModal">
        <div class="modal-header">
            <strong>CashOut</strong>
        </div>
        <div class="modal-body">
            <div class="loginbox">
                <p class="text-danger">{{messeger}}</p>
                <form name="simpleForm" method="post" class="bv-form" novalidate="novalidate">
                    <div class="form-group">
                        <label>Payment Method</label>
                        <ui-select ng-model="payment.selected">
                            <ui-select-match placeholder="Select or search a payment in the list...">
                                {{$select.selected.Name}}
                            </ui-select-match>
                            <ui-select-choices repeat="item in PaymentMethod | filter: $select.search">
                                <span ng-bind="item.Name"></span>
                            </ui-select-choices>
                        </ui-select>
                        {{data.PaymentId=payment.selected.Id;""}}
                    </div>
                    <div class="form-group">
                        <label>Amount (฿)</label>
                        <input class="form-control" ng-model="data.Amount" type="text" ng-pattern="/^[0-9.]+$/" ng-change="doProcess(data)">

                    </div>
                    <!--<div class="form-group">
                        <label>Fee {{data.Fee}}%</label>
                        <input class="form-control" ng-model="data.Fee" placeholder="Fee" type="text" readonly>
                    </div>
                    <div class="form-group">
                        <label>After Fee</label>
                        <input class="form-control" ng-model="data.After" placeholder="Amount" type="text" readonly>
                    </div>-->
                    <div class="form-group">
                        <label> Wallet</label>
                        <input class="form-control" ng-model="data.Balance" type="text" readonly>
                    </div>
                </form>
            </div>
        </div>
        <div class="modal-footer">
            <span ng-if="processing" class="text-success"><i class="fa fa-circle-o-notch fa-spin"></i></span>
            <button type="button" class="btn btn-success" ng-click="doCashout(data)" ng-disabled="processing">Cash Out</button>
            <button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
        </div>
    </script>
</div>
<script type="text/ng-template" id="FormTransaction">
    <div class="modal-header">
        <strong>Cashout</strong>
    </div>
    <div class="modal-body">
        <div class="loginbox">
            <p class="text-danger">{{messeger}}</p>
            <form name="simpleForm" method="post" class="bv-form" novalidate="novalidate">
                <div class="form-group">
                    <label>User send :</label>
                    <b>{{data.usersend}}</b>
                </div>
                <div class="form-group">
                    <label>Transaction code :</label>
                    <b>{{data.transactioncode}}</b>
                </div>
                <div class="form-group">
                    <label> Date :</label>
                    <b>{{data.createdate}}</b>
                </div>
            </form>
        </div>
    </div>
    <div class="modal-footer">
        <span ng-if="processing" class="text-success"><i class="fa fa-circle-o-notch fa-spin"></i></span>
        <button type="button" class="btn btn-success" ng-click="ok()">Cancel</button>
    </div>
</script>
